package com.api.shopapi.service.impl;


import com.api.shopapi.entity.ActivityItem;
import com.api.shopapi.entity.ActivityType;
import com.api.shopapi.mapper.ActivityItemMapper;
import com.api.shopapi.service.ActivityItemService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("ActivityItemServiceImplOne")
public class ActivityItemServiceImpl implements ActivityItemService {

    @Autowired
    private ActivityItemMapper activityItemMapper;

    @Override
    public
    int insert(ActivityItem activityItem){
        return activityItemMapper.insert(activityItem);
    }

    @Override
    public
    int delete(String activityItemCode){
        return activityItemMapper.delete(activityItemCode);
    }

    @Override
    public
    int update(ActivityItem activityItem){
        return activityItemMapper.update(activityItem);
    }

    @Override
    public
    ActivityItem getByActivityItemCode(String activityItemCode){
        return activityItemMapper.getByActivityItemCode(activityItemCode);
    }

    @Override
    public
    List<ActivityItem> ListByActivityTypeCode(String activityTypeCode){
        return activityItemMapper.ListByActivityTypeCode(activityTypeCode);
    }


    @Override
    public
    PageInfo<ActivityItem> pageByCommandCenterCodeActivityTypeCode(int pageIndex, int pageSize, String commandCenterCode,
                                                                String activityTypeCode){
        PageHelper.startPage(pageIndex,pageSize);
        List<ActivityItem> complaintList =activityItemMapper.listByCommandCenterCodeActivityTypeCode(commandCenterCode,activityTypeCode);
        return new PageInfo<>(complaintList);
    }


}
